package com.lions.client.controller;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HasAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.lions.client.model.Model;

/**
 * Call this class to add button action listeners.
 * And other things.
 * @author
 */
public class Controller {
	/**
	 * Default Constructor.
	 * @param m pointer to model.
	 */
	public Controller(final Model m) {
		this.model = m;
		speech = new Speech(this, model);
		initControllerPanel();
	}

	/**
	 * Initializes all of the components for this panel
	 */
	private void initControllerPanel() {
		controllerPanel = new HorizontalPanel();
		controllerPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
		controllerPanel.addStyleName(controlCSSString);
		
		addModuleButton = new Button("Add Module");
		addModuleButton.setStyleName(buttonStyle);
		editModuleButton = new Button("Edit Module");
		editModuleButton.setStyleName(buttonStyle);
		removeModuleButton = new Button("Remove Module");
		removeModuleButton.setStyleName(buttonStyle);
		controllerPanel.add(addModuleButton);
		controllerPanel.add(editModuleButton);
		controllerPanel.add(removeModuleButton);
		controllerPanel.add(speech);
		buildBaseButton = new Button("Build Selected Base");
		buildBaseButton.setStyleName(buttonStyle);
		editBaseButton = new Button("Edit Current Base");
		editBaseButton.setStyleName(buttonStyle);
	}

	/**
	 * Returns the actual button to add actions listeners.
	 * 
	 * @return
	 */
	public Button getAddButton() {
		return addModuleButton;
	}

	/**
	 * Returns the actual button to add actions listeners.
	 * 
	 * @return
	 */
	public Button getEditButton() {
		return editModuleButton;
	}

	/**
	 * Returns the actual button to add actions listeners.
	 * 
	 * @return
	 */
	public Button getModuleRemoveButton() {
		return removeModuleButton;
	}

	/**
	 * Returns the actual button to add actions listeners.
	 * 
	 * @return
	 */
	public Button getBuildBaseButton() {
		return buildBaseButton;
	}

	/**
	 * Returns the actual button to add actions listeners.
	 * 
	 * @return
	 */
	public Button getEditBaseButton() {
		return editBaseButton;
	}

	public HorizontalPanel getControllerPanel() {
		return controllerPanel;
	}

	public Speech getSpeech() {
		return speech;
	}

	/**
	 * CSS String.
	 */
	private String buttonStyle = "buttonstyle";
	/**
	 * CSS String.
	 */
	private String controlCSSString = "controlpanel";
	/**
	 * Add Button.
	 */
	private Button addModuleButton;
	/**
	 * Edit button.
	 */
	private Button editModuleButton;
	/**
	 * Remove button.
	 */
	private Button removeModuleButton;
	/**
	 * Build button.
	 */
	private Button buildBaseButton;
	/**
	 * Edit button.
	 */
	private Button editBaseButton;
	/**
	 * Buttons panel.
	 */
	private HorizontalPanel controllerPanel;
	/**
	 * Model pointer.
	 */
	private Model model;
	/**
	 * Speech input.
	 */
	private Speech speech;

}